package com.ehotting.edsta.circuitDesign.domain;

import com.ehotting.edsta.circuitDesign.enums.DataTypeEnum;
import com.ehotting.edsta.circuitDesign.gen.element.helper.ElementDataHelper;
import com.ehotting.eaf.core.annotation.Excel;
import com.ehotting.eaf.core.web.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Map;


/**
 * 元器件对象 es_element
 *
 * @author edsta
 * @date 2023-05-08
 */
public class EsElement extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 编号
     */
    private Long id;

    /**
     * 名称
     */
    @Excel(name = "名称")
    private String name;

    /**
     * 类型
     */
    @Excel(name = "元器件类型")
    private Integer type;


    @Excel(name = "数据类型")
    private DataTypeEnum dataType;

    /**
     * 序号
     */
    @Excel(name = "序号")
    private Long priority;

    /**
     * 编码
     */
    @Excel(name = "编码")
    private String code;

    /**
     * 值
     */
    @Excel(name = "值")
    private String value;

    /**
     * 备注
     */
    @Excel(name = "备注")
    private String remarks;

    /**
     * 备注
     */
    @Excel(name = "单位")
    private String unit;

    /**
     * 制造商
     */
    @Excel(name = "制造商")
    private String manufacturer;

    /**
     * 价格
     */
    @Excel(name = "价格")
    private Double price;

    /**
     * 面积（平方毫米）
     */
    @Excel(name = "面积（平方毫米）")
    private Double area;

    /**
     * 功率
     */
    @Excel(name = "功率")
    private Double power;

    /**
     * 备注
     */
    @Excel(name = "拓展参数")
    /**
     * json命令参数及参数值{"key":"value","key1":"value1"}
     */
    @ApiModelProperty(value = "json命令参数及参数值{'key':'value','key1':'value1'}")
    private Map props;

    public EsElement() {
    }

    public EsElement(Long id, String value) {
        this.id = id;
        this.value = value;
    }

    public EsElement(Long id, String name, Integer type, Long priority, String code, String value, String remarks, String unit, Map props) {
        this.id = id;
        this.name = name;
        this.type = type;
        this.priority = priority;
        this.code = code;
        this.value = value;
        this.remarks = remarks;
        this.unit = unit;
        this.props = props;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Integer getType() {
        return type;
    }

    public void setPriority(Long priority) {
        this.priority = priority;
    }

    public Long getPriority() {
        return priority;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getCode() {
        return code;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public String getRemarks() {
        return remarks;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public Map<String, Object> getProps() {
        return props;
    }

    public void setProps(Map<String, Object> props) {
        this.props = props;
    }

    public double prop(String key) {
        return ElementDataHelper.prop(this, key);
    }

    public String getManufacturer() {
        return manufacturer;
    }

    public void setManufacturer(String manufacturer) {
        this.manufacturer = manufacturer;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public Double getArea() {
        return area;
    }

    public void setArea(Double area) {
        this.area = area;
    }

    public DataTypeEnum getDataType() {
        return dataType;
    }

    public void setDataType(DataTypeEnum dataType) {
        this.dataType = dataType;
    }

    public Double getPower() {
        return power;
    }

    public void setPower(Double power) {
        this.power = power;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("name", getName())
                .append("type", getType())
                .append("priority", getPriority())
                .append("generation", getCode())
                .append("value", getValue())
                .append("remarks", getRemarks())
                .append("unit", getUnit())
                .append("manufacturer", getManufacturer())
                .append("price", getPrice())
                .append("area", getArea())
                .append("power", getPower())
                .append("props", getProps())
                .toString();
    }
}
